package com.netease.nie.dao;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.netease.nie.base.exceptions.BusinessException;
import com.netease.nie.constants.BusinessConstants;
import com.netease.nie.mapper.GoodsInfoMapper;
import com.netease.nie.model.GoodsInfo;

@Repository
public class GoodsInfoDao {

	@Resource
	private GoodsInfoMapper goodsInfoMapper;
	
	public GoodsInfo queryGoodsInfoById(int id) {
		GoodsInfo goodsInfo = goodsInfoMapper.queryGoodsInfoById(id);
		if (goodsInfo == null)
			throw new BusinessException(BusinessConstants.GOODS_NOT_EXISTS.getCode(), "商品不存在");
		return goodsInfo;
	}
	
	public List<GoodsInfo> queryGoodsInfoListByIds(List<Integer> ids) {
		return goodsInfoMapper.queryGoodsInfoListByIds(ids);
	}
}
